"""
元素的操作:
1点击事件  元素.click()
2 往输入框输入值  元素.send_keys(字符串类型的值)
3 清除输入框里面的值  元素.clear()
"""

import time

from robot.parsing.lexer.statementlexers import ElseHeaderLexer
from selenium import webdriver
from selenium.webdriver import Keys
from selenium.webdriver.common.by import By

driver=webdriver.Edge()
driver.get("http://localhost:8081/regA.html")

ele=driver.find_element(By.CSS_SELECTOR,"#userA")
ele.send_keys("admin1")
time.sleep(2)
ele.send_keys(Keys.BACKSPACE)
ele.send_keys(Keys.CONTROL,"a")
time.sleep(2)
ele.send_keys(Keys.CONTROL,"c")
elepwd=driver.find_element(By.CSS_SELECTOR,"#passwordA")
elepwd.send_keys(Keys.CONTROL,"v")

if elepwd.get_attribute("value")=="admin":
    print("一致")
else:
    print("不一致")







# 4 关闭浏览器驱动对象
time.sleep(10)  #代码暂停10s中
driver.quit()
